// 账号密码台账
const sequelize = require('../config.js')
const { DataTypes } = require('sequelize')

const userledger = sequelize.define('userledger', {
	Id:{
		type: DataTypes.INTEGER,
		primaryKey: true,
		autoIncrement: true
	},
	info_id: {
	  type: DataTypes.INTEGER,
	  allowNull: false,
	  references: {
		model: 'userInfos',
		key: 'user_id',
	  },
	  onDelete: 'CASCADE',
	  comment: '用户信息ID'
	},
	user_password: {
	  type: DataTypes.STRING,
	  allowNull: false,
	  comment: '用户密码'
	},
	user_phone: {
		type:DataTypes.STRING,
		allowNull:false,
		comment:'手机号(登录名)'
	},
  },{timestamps: false});
//   (async () => {
// 	await userledger.sync({alter:true});
//   })()

module.exports = userledger